<?php
/*
   Copyright 2011 BiSe Trojanov

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
 require_once('config.php');

?><!doctype html><html>
<head>
 <?php include('./include/header.inc'); ?>
 <title><?php echo $LANGS['delete']['title'].' / '.$sad_domain; ?></title>

</head>
<body>

<?php
 if ((int)$_GET['id']>0 and strlen($_GET['table'])>0){
  if (preg_match('|^_users$|i',$_GET['table']) and !iamd()){
   header('http/1.0 403');
   echo 'No, you can not delete records from admin table</body></html>';
   exit;
  }
  if ((int)$_GET['confirm']>0){
   mysql_query('delete from `'.sad_safe_mysql($sad_prefix.$_GET['table']).
               '` where `id`='.(int)$_GET['id']);
   echo 'Deleted <script>window.close();</script></body></html>';
   exit;
  }
 
 
 echo preg_replace('|{#id#}|',(int)$_GET['id'],$LANGS['delete']['text']);

?>
<br><a href="?" onclick="window.close();" class="nicebutton" style="color: #ccffcc; font-weight: bold;"><?php echo $LANGS['delete']['no']; ?></a>
<a href="?table=<?php echo urlencode($_GET['table']);?>&amp;id=<?php echo (int)$_GET['id'];?>&amp;confirm=1"  class="nicebutton" style="width: 100px; color: #ffcccc;"><?php echo $LANGS['delete']['yes']; ?></a><?php
 }else{
?><script>window.close();</script></body></html><?php
  exit;
 }

?>



</body></html>